<script setup>
import { ref, h } from 'vue'
import CodeShow from './CodeShow.vue'
import { codeTextSetupSugerHfn } from './codetext'

const props = defineProps({
  msg: String
})

const count = ref(0)
const increment = () => count.value++

// 直接定义 render 函数
const render = () => h('div', [
  h('h2', { class: 'title' }, props.msg),
  h('button', { type: 'button', onClick: increment }, `count is ${count.value}`),
  h(CodeShow, { 'code-text': codeTextSetupSugerHfn })
])
</script>

<template>
  <render />
</template>

<style scoped>
.title {
  color: red;
}
</style>